home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / graphics / qrt.lzh / ADDEND14.DOC < prev    next >
Text File  |  1989-02-16  |  16KB  |  397 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.         
  9.         
  10.                            Addendum to QRT Version 1.4
  11.         
  12.         
  13.         
  14.         The following are changes to QRT made since version 1.3
  15.         
  16.         Additions and Enhancements
  17.         
  18.            Transmission
  19.                
  20.                Transmission of light through surfaces now works, allowing
  21.                one to  model  glass  surfaces.   Some  additions  to  and
  22.                changes  from  the  original  grammar  were  necessary  to
  23.                provide  the  desired   functionality.    A  new  keyword,
  24.                "DENSITY", has been  added,  and  the  function of the old
  25.                "TRANS" keyword has  been  changed.   Also,  a "THRESHOLD"
  26.                parameter has been added to the  default structure.  Since
  27.                transmission is a complex operation,  this entire Addendum
  28.                will discuss aspects of modeling glass surfaces.
  29.                
  30.            The DENSITY keyword
  31.                
  32.                It was my previous  intent  that  the  TRANS keyword would
  33.                specify  the  percent  transmission  of  light  though the
  34.                surface.  After thinking a little more about the nature of
  35.                light  transmission,  it   was   clear  that  this  wasn't
  36.                adequate.  The amount  of  light  transmitted  depends not
  37.                only on a fixed  coefficient  of  the  surface, but on the
  38.                thickness of the  surface.   For  example,  a hollow glass
  39.                sphere will appear darker  (transmit  less light) near the
  40.                edges, where the glass is  thickest.   To account for this
  41.                effect,  the  "DENSITY"   keyword   was  added.    Density
  42.                specifies what  percentage  of  transmitted  light will be
  43.                removed per unit  distance  travelled  though  the object.
  44.                For example, the following density  attribute would remove
  45.                2 percent of all light per unit distance:
  46.                
  47.                     DENSITY = (.02, .02, .02);
  48.                
  49.                If a sphere, at its widest  point,  was 10 units thick, 20
  50.                percent of the light would  be  removed.  Near the edge of
  51.                the sphere, less light would be removed.
  52.                
  53.                Since density is a function of  distance, the same density
  54.                factor will have different effects on objects of different
  55.                sizes.  To remove the  same  percentage  of  light from an
  56.                object half as thick, double the density factor.
  57.                
  58.  
  59.  
  60.         QRT Ray Tracer               Page 1               Addendum to 1.4
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.            Shadows from Transparent Surfaces
  74.                
  75.                The old "TRANS" keyword  still  exists,  but it performs a
  76.                different function.  It does not  affect the appearance of
  77.                the object, but rather, the  attenuation  of  light passed
  78.                through the surface.  QRT  knows  how  glass surfaces bend
  79.                light, and so it  can  model  the  magnifying  effects  of
  80.                looking through  curved  glass,  etc.   But  for computing
  81.                shadows, it cannot  properly  bend  the  light from lamps.
  82.                This means that you  can  model  lenses  that the observer
  83.                looks through, but  not  lenses  used  to focus light.  In
  84.                order to provide  some attenuation effects, use "TRANS" to
  85.                tell QRT how much light  is  passed  through  the surface.
  86.                This information is ONLY used  for computing shadows.  For
  87.                example,  blue  glass  should  cast  a  blue  shadow.  Use
  88.                something similar to:
  89.                
  90.                         TRANS = (0, 0, .7)
  91.                
  92.                to cast a blue shadow (this  lets  70  percent of the blue
  93.                light pass).  Note that by  using  strange combinations of
  94.                DENSITY and TRANS, you can  model  illogical objects which
  95.                appear, for example, blue,  but  cast a red shadow.  These
  96.                shadows will be entirely of  one  intensity,  and will not
  97.                vary with the thickness of the glass.
  98.                
  99.            Using MIRROR with Transparent surfaces
  100.                
  101.                Glass surfaces not only refract  light, but also reflect a
  102.                percentage of it.  This means  that to realistically model
  103.                glass, the glass should reflect  a small percentage of the
  104.                light.   Try starting with  20  to  25 percent reflection.
  105.                Note that all glass objects  reflect  light  from both the
  106.                outside and the inside surfaces of the glass.
  107.                
  108.            Index of Refraction
  109.                
  110.                The index of refraction for an object governs how much the
  111.                light is bent  upon  entering  or  exiting  the object.  A
  112.                higher index will  bend  the  light  more.   The  index of
  113.                refraction of air is 1.00, and  for glass is roughly 1.33.
  114.                Some substances, such as diamond, have a higher index.
  115.                
  116.            Modeling Hollow Objects
  117.                
  118.                When designing the QRT transmission  routines, I wanted to
  119.                be able  to  model  both  solid  glass  and  hollow  glass
  120.                objects.  To understand how this  is done, it is necessary
  121.                to understand a little about how  QRT's transmission model
  122.                works.
  123.                
  124.  
  125.  
  126.         QRT Ray Tracer               Page 2               Addendum to 1.4
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                A ray, after leaving the observer,  has two states: either
  140.                it is inside a glass  object,  or  it is outside.  The ray
  141.                starts out outside.   When  it  first  encounters  a glass
  142.                surface, it is bent, and its state is toggled from OUTSIDE
  143.                to INSIDE.  It continues  on  until  encountering  another
  144.                surface, whereupon it is bent again, and its state is once
  145.                more toggled.  This has several  implications for modeling
  146.                glass.  The first is that ALL glass surfaces MUST have two
  147.                sides - that is, once the ray enters the glass, there must
  148.                be no way for it to exit  without  again passing through a
  149.                surface.  The second is that  a  ray must go from glass to
  150.                air, or air to glass,  but  not  from  glass with index of
  151.                refraction A to glass with index of refraction B; i.e, the
  152.                two glass surfaces cannot  touch  each  other, even though
  153.                they may be placed very close together.
  154.                
  155.                As an example of how this  works,  consider  a solid glass
  156.                sphere.  The ray encounters  the  sphere,  and is bent (in
  157.                this case, towards the normal  vector).  QRT now remembers
  158.                that  the  ray  is  INSIDE  a  glass  surface.    The  ray
  159.                continues on until it hits  the  back  side of the sphere,
  160.                whereupon it is bent (away  from  the  normal vector), and
  161.                its  state  is  toggled  to   OUTSIDE.   In  summary,  the
  162.                INSIDE/OUTSIDE flag tells QRT how to bend the ray.
  163.                
  164.                Consider now the case of a  hollow  glass sphere.  This is
  165.                modeled using two concentric  spheres,  one with a smaller
  166.                radius.  The ray will  first  hit  the  outside sphere, be
  167.                bent, and have its state toggled  to INSIDE. There are now
  168.                two possible cases.  First,  the  ray  may miss the inside
  169.                sphere, in which case the  simulation  proceeds  as in the
  170.                above paragraph.  Second,  it  may  hit the inside sphere.
  171.                In this case, it is  bent,  and  its  state  is toggled to
  172.                OUTSIDE.  The ray is now considered  to be back in air, so
  173.                that the inside sphere has  modeled  the hollow portion of
  174.                the glass.  In a similar manner, the ray r